package cn.yj.core.geo;

import java.util.Map;

/**
 * <p>
 *
 * </p>
 *
 * @author 永健
 * @since 2019-07-30 18:19
 */
public interface Geo
{

    enum Cordons
    {
        gps, mapbar, baidu, autonavi;
    }

    /**
     * <br>
     * 坐标转换
     */
    String GEO_COVERT_URL = "https://restapi.amap.com/v3/assistant/coordinate/convert";
    String GEO_COORDI_TO_ADDRESSS_URL = "https://restapi.amap.com/v3/geocode/regeo";


    String GEO_GET_PRO_CITY_URL = "https://restapi.amap.com/v3/geocode/regeo";

    /**
     * <br>
     *  根据位置获取经纬度
     */
    String GEO_PS_TO_LOCTION = "https://restapi.amap.com/v3/geocode/geo";

    /**
     * 获取全国行政区
     */
    String GEO_DISTRICT_URL = "https://restapi.amap.com/v3/config/district";

    /**
     * 根据位置 获取省市相关信息
     */
    String GEO_MSG_URL = "https://restapi.amap.com/v3/geocode/geo";



    /**
     * 高德坐标转换
     * <p>
     * key:
     * locations：经度在前纬度在后；多个 | 隔开
     * output： 数据响应格式
     * coordsys: gps、mapbar、baidu、autonavi
     *
     * @return status
     * <p>
     * 返回状态
     * <p>
     * 值为0或1
     * <p>
     * 1：成功；0：失败
     * <p>
     * info
     * <p>
     * 返回的状态信息
     * <p>
     * status为0时，info返回错误原；否则返回“OK”。详情参阅info状态表
     * <p>
     * locations
     * <p>
     * 转换之后的坐标。若有多个坐标，则用 “;”进行区分和间隔
     * @throws Exception
     */
    String coordinateConvert(Cordons cordons, String locations) throws Exception;

    /**
     * 解析高德坐标
     *
     * @param location
     *         高德坐标
     *
     * @return
     * @throws Exception
     */
    Map<String, Object> coordToAddress(String location) throws Exception;

    Map<String, Object> district() throws Exception;

    /**
     * 根据经纬度获取省市
     * @param lngLat
     * @return
     * @throws Exception
     */
    Map<String, Object> getProAndCityByngLat(String lngLat) throws Exception;

    /**
     *  根据位置获取经纬度
     * @param address
     * @param city
     * @return
     * @throws Exception
     */
    Map<String, Object> psToLocation(String address,String city) throws Exception;


    /**
     * 根据位置信息获取省市 当前经纬度
     * @param address
     * @return
     * @throws Exception
     */
    Map<String, Object> getMsgByAddress(String address) throws Exception;

    /**
     * 根据经纬度坐标获取市
     * @param location "121.1281,1289311"
     * @return [广东省，广州市]
     */
    String[] getCityByLocation(String location) throws Exception;

}
